{% macro Reader(reader) %}
    <textarea id="{{ reader.id }}">{{ reader.content | safe }}"></textarea>

    <script>
        ClassicEditor
            .create(document.querySelector('#{{ reader.id }}'), {
                toolbar: [], // 禁用工具栏
                isReadOnly: true
            })
            .then(editorInstance => {
                editorInstance.setData(`{{ reader.content | safe }}`);
                editorInstance.isReadOnly = true;
            })
            .catch(error => {
                console.error("ReadOnlyEditor initialization error:", error);
            });
    </script>
{% endmacro %}

{# 可编辑的 Editor 宏 #}
{% macro Editor(editor) %}
    <textarea id="{{ editor.id }}">{{ editor.content | safe }}</textarea>

    <script>
        ClassicEditor
            .create(document.querySelector('#{{ editor.id }}'))
            .then(editorInstance => {
                editorInstance.setData(`{{ editor.content | safe }}`);
            })
            .catch(error => {
                console.error("Editor initialization error:", error);
            });
    </script>
{% endmacro %}